﻿using UnityEngine;
using System.Collections;

public class PipeAnim : MonoBehaviour {

    [HideInInspector]
    public bool playAnim;     //是否播放动画

    private Animator anim;    //动画组件

    
    void Start ()
    {
        anim = GetComponent<Animator>();
	}
	
	
	void Update ()
    {
       
        if (playAnim)
        {
            StartCoroutine(PlayAnim());
        }
            
    }

    //播放动画
    IEnumerator PlayAnim()
    {
        anim.Play("PipeAnim");
        yield return new WaitForSeconds(0.33f);
        anim.Play("PipeIdle");
        playAnim = false;
    }


}
